<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>查询订单结果</title>
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/css/bootstrap.min.css" />
<script src="${pageContext.request.contextPath}/js/jquery-3.2.1.min.js"
	type="text/javascript" charset="utf-8"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"
	type="text/javascript" charset="utf-8"></script>
</head>
<body>
	<!-- 头部 -->
	<jsp:include page="header.jsp"></jsp:include>

	<!-- 导航搜索栏 -->
	<jsp:include page="navigation.jsp"></jsp:include>

	<div class="container">
		<form class="form-inline" action="${pageContext.request.contextPath}/order/user-findOrder.do" method="post">
			<label>查询订单</label> <input type="text" name="productName" class="form-control"
				placeholder="请输入商品名称查询" />
			<button type="submit" class="btn btn-primary">查询</button>
		</form>
	</div>

		<div class="container">
		<h3>查询结果</h3>
		<h4>${noresult}</h4>
		<c:forEach items="${rtOrders}" var="order">
			<h4><a href="${pageContext.request.contextPath}/order/user-getByOrderId.do?orderId=${order.orderId}">订单编号:${order.orderId}</a></h4>
			<h5 style="color:gray">下订时间:${order.timeStr}</h5>
		<table class="table table-hover" style="border: 1px solid gray;">
			
			<thead>
				<tr>
					<th></th>
					<th>商品</th>
					<th>单价</th>
					<th>数量</th>
					<th>小计</th>
				</tr>

			</thead>
			<tbody>
			<c:forEach items="${order.orderItems}" var="orderItem">
				<tr>
					<td><img src="${pageContext.request.contextPath}/img/background.jpg"
						style="width: 60px; height: 60px;"></td>
					<td><a href="${pageContext.request.contextPath}/product?method=user-findById.do&productId=${orderItem.product.productId}">${orderItem.product.productName}&nbsp;${orderItem.product.productDesc}</a></td>
					<td>${orderItem.product.price }</td>
					<td>${orderItem.buyNum}</td>
					<td>${orderItem.money}</td>
				</tr>
				
			</c:forEach>
				<tr>
					<td colspan="4" align="right">总金额:${order.totalMoney}</td>
					<td><button type="button" class="btn btn-danger" onclick="location.href='${pageContext.request.contextPath}/user?method=withdraw.do&orderId=${order.orderId}'">撤销订单</button></td>
				</tr>
			</tbody>
		</table>
		</c:forEach>
	</div>
</body>
</html>

